<template>
	<view :class="viewMode=='day'?'fy-top-background':'fy-top-background-night'" :style="viewMode=='day'?'background-color:'+bgColor+';':'background:url('+nightBackground+');background-position: center center;background-size: cover;'">
		<view class="wave wave1" v-if="viewMode=='day'"></view>
		<view class="wave wave2" v-if="viewMode=='day'"></view>
		<view class="wave wave3" v-if="viewMode=='day'"></view>
		<view class="wave wave4" v-if="viewMode=='day'"></view>
	</view>
</template>

<script>
	export default {
		name:"fy-top-background",
		props:{
			bgColor:{
				type:String,
				default:"#3586ff"
			},
			viewMode:{
				type:String,
				default:""
			},
			nightBackground:{
				type:String,
				default:null
			}
		},
		data() {
			return {
				
			};
		}
	}
</script>

<style scoped lang="scss">
	* {
		margin: 0;
		padding: 0;
	}
	.fy-top-background-night {
		position: relative;
		width: 100%;
		height: 280px;
	}
	.fy-top-background {
		position: relative;
		width: 100%;
		height: 280px;
		overflow: hidden;
		.wave {
		    width: 100%;
		    height: 50px;
		    position: absolute;
		    bottom: 0;
		    left: 0;
		    background: url("./static/images/wave.png");
		    background-size: 1000px 50px;
		}
		.wave.wave1 {
		    animation: animate1 20s linear infinite;
		    z-index: 1000;
		    opacity: 1;
		    animation-delay: 0s;
		    bottom: 0;
		}
		
		.wave.wave2 {
		    animation: animate2 15s linear infinite;
		    z-index: 999;
		    opacity: 0.5;
		    animation-delay: -5s;
		    bottom: 7px;
		}
		
		.wave.wave3 {
		    animation: animate1 10s linear infinite;
		    z-index: 998;
		    opacity: 0.2;
		    animation-delay: -7s;
		    bottom: 12px;
		}
		
		.wave.wave4 {
		    animation: animate2 5s linear infinite;
		    z-index: 997;
		    opacity: 0.71;
		    animation-delay: -5s;
		    bottom: 16px;
		}
	}
	
	@keyframes animate1 {
	    0% {
	        background-position-x: 0;
	    }
	    100% {
	        background-position-x: 1000px;
	    }
	}
	
	@keyframes animate2 {
	    0% {
	        background-position-x: 0;
	    }
	    100% {
	        background-position-x: -1000px;
	    }
	}
</style>